JBoss Community Archive (Read Only)

Portlet Bridge 3.2

CDI Configuration

There are a couple of steps to enabling CDI for JSF2 portlets that use Portlet Bridge.

Artifacts

First is to add the following dependency to your pom.xml to add the portlet integration library for CDI:

CDI Portlet Integration Maven Artifacts for JSF2
<dependency>
    <groupId>org.gatein</groupId>
    <artifactId>cdi-portlet-integration</artifactId>
    <version>1.0.0.Final</version>
</dependency>

Deploying to GateIn

When deploying to GateIn, the portlet integration library for CDI is automatically included for JSF2 portlets that use CDI.

So we need to ensure the dependency is marked as provided in our pom.xml:

<dependency>
    <groupId>org.gatein</groupId>
    <artifactId>cdi-portlet-integration</artifactId>
    <version>1.0.0.Final</version>
    <scope>provided</scope>
</dependency>

Portlet Filter

Add the following portlet filter definition into your portlet.xml:

<filter>
    <filter-name>PortletCDIFilter</filter-name>
    <filter-class>org.gatein.cdi.PortletCDIFilter</filter-class>
    <lifecycle>ACTION_PHASE</lifecycle>
    <lifecycle>EVENT_PHASE</lifecycle>
    <lifecycle>RENDER_PHASE</lifecycle>
    <lifecycle>RESOURCE_PHASE</lifecycle>
</filter>

Then add to portlet.xml the activation of the above filter for each portlet that requires CDI:

<filter-mapping>
    <filter-name>PortletCDIFilter</filter-name>
    <portlet-name>[Name of your portlet as defined in portlet-name]</portlet-name>
</filter-mapping>
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:28:03 UTC, last content change 2013-05-08 19:08:04 UTC.